


const Customer = {

    template:`

        <form id="frm_customer">

                <div><span>客户名称:</span></div>
                <div><input name="name" type="text" v-model="record.name" /></div>
                <div><span>客户地址:</span></div>
                <div><input name="address" type="text" v-model="record.address" /></div>
                <div><span>客户电话:</span></div>
                <div><input name="tel" type="text" v-model="record.tel" /></div>
                <div><span>客户别名:</span></div>
                <div><input name="alias" type="text" v-model="record.alias" /></div>
                <div><el-button type='primary' @click="test">测试数据</el-button></div>
        
        </form>

    
    `,




    setup(){


       const message = Vue.ref('这是Customer组件');
        const record = Vue.ref({

                name:"",
                address:"宁波",
                tel:"0574-",
                alias:""

        })

        const test = ()=>{


            fetch("http://yhdn.cn:5000/saveall/yhdn/product",{
                method:"POST",
                body:JSON.stringify({fields:["name","addreess","tel","alias"],rows:[]}),
                headers:{

                    'Content-Type':"application/json"
                }
            }).then(resp=>resp.json())
            .then(
                data=>console.log(data)                
            )
        }

        return {


            message,
            record,
            test
        }

    }


}

